<div class="row-fluid">
	<div class="span3">
	    <fieldset>
			<legend>${right.name}</legend> 
			<p><i class="icon-info-sign"></i>&nbsp;<strong>#i18n{portal.features.assign_users.right.description}</strong></p>
			<p>${right.description}</p>
            <p><strong>#i18n{portal.features.assign_users.right.level}</strong> : <span class="badge">${right.level} </span></p>
            <p><i class="icon-user"></i>&nbsp;<strong>#i18n{portal.features.assign_users.right.number_user}</strong> : <span class="badge">${assigned_users_number}</span></p>
            <#if assigned_users_list?size &gt; 0 || search_is_search >
				<form method="post" name="search_users" action="jsp/admin/features/AssignUsersRight.jsp"  >
					<#if (user_levels?has_content)>
						<label for="user_level">#i18n{portal.users.manage_users.search_users.userLevelLabel} :</label>
                        <select id="user_level" name="search_user_level">
                            <#if (search_admin_user_filter.userLevel > -1) >
                                <option value="noValue" >#i18n{portal.users.manage_users.search_users.labelAllLevels}</option>
                                <#list user_levels as user_level>
                                <#if (search_admin_user_filter.userLevel == user_level.id) >
                                <option value="${user_level.id}" selected="selected" >${user_level.name}</option>
                                <#else>
                                <option value="${user_level.id}" >${user_level.name}</option>
                                </#if>
                                </#list>
                                <#else>
                                <option value="noValue" selected="selected" >#i18n{portal.users.manage_users.search_users.labelAllLevels}</option>
                                <#list user_levels as user_level>
                                <option value="${user_level.id}" >${user_level.name}</option>
                                </#list>
                                </#if>
                        </select>
                    </#if>
                    <label for="access_code" >#i18n{portal.users.manage_users.search_users.labelAccessCode} :</label>
                    <input type="text" id="access_code" name="search_access_code" value="${search_admin_user_filter.accessCode}" />
                    <label class="control-label" for="last_name" >#i18n{portal.users.manage_users.search_users.labelLastName} :</label>
                    <input type="text" id="last_name" name="search_last_name" value="${search_admin_user_filter.lastName}" maxlength="100" size="35" tabindex="2" />
                    <label class="control-label" for="first_name">#i18n{portal.users.manage_users.search_users.labelFirstName} :</label>
                    <input type="text" id="first_name" name="search_first_name" value="${search_admin_user_filter.firstName}" maxlength="100" size="35" tabindex="3" />
                    <label class="control-label" for="email">#i18n{portal.users.manage_users.search_users.labelEmail} :</label>
                    <input type="text" id="email" name="search_email" value="${search_admin_user_filter.email}" maxlength="100" size="35" tabindex="4" />
                    <label class="control-label" for="status">#i18n{portal.users.manage_users.search_users.labelStatus} :</label>
                    <select id="status" name="search_status" tabindex="5">
						<#switch search_admin_user_filter.status >
							<#case 0 >
                                <option value="noValue" >#i18n{portal.users.manage_users.search_users.labelAllStatus}</option>
                                <option value="0" selected="selected" >#i18n{portal.users.create_user.statusLabelEnabled}</option>
                                <option value="1" >#i18n{portal.users.create_user.statusLabelDisabled}</option>
                                <#break>
                                <#case 1 >
                                <option value="noValue" >#i18n{portal.users.manage_users.search_users.labelAllStatus}</option>
                                <option value="0" >#i18n{portal.users.create_user.statusLabelEnabled}</option>
                                <option value="1" selected="selected" >#i18n{portal.users.create_user.statusLabelDisabled}</option>
                                <#break>
                                <#default>
                                <option value="noValue" selected="selected" >#i18n{portal.users.manage_users.search_users.labelAllStatus}</option>
                                <option value="0" >#i18n{portal.users.create_user.statusLabelEnabled}</option>
                                <option value="1" >#i18n{portal.users.create_user.statusLabelDisabled}</option>
                                <#break>
                                </#switch>
                            </select>
                            <#list attributes_list as attribute>
                            <#if attribute.shownInSearch>
                            ${attribute.getHtmlFormSearchAttribute( search_admin_user_field_filter, locale )}
                            </#if>
                            </#list>
                            <input type="hidden" name="id_right" value="${right.id}" />
                            <button type="submit" class="btn btn-primary btn-small" tabindex="2" name="search_is_search">
                                <i class=" icon-search icon-white"></i>
                                <span class="hidden-phone" >#i18n{portal.users.manage_users.search_users.buttonSearch}</span>
                            </button>          
                        </form>
                    </fieldset>
                </div>
                <div class="span9">
                    <fieldset>
                        <legend>#i18n{portal.features.assign_users.pageTitle}
						 <small class="pull-right">
							<@item_navigation item_navigator=item_navigator />
						</small>
						</legend>
                        <#if available_users_list?size &gt; 0 >
                        <form name="assignUser" method="post" action="jsp/admin/features/DoAssignUsersRight.jsp">
                            <input type="hidden" name="id_right" value="${right.id}" />
                            <label>#i18n{portal.features.assign_users.labelAvailableUser}</label>			
                            <@comboWithParamsAndLength name="available_users_list" default_value="" additionalParameters="multiple='multiple' size='10' style='width:100%;'" items=available_users_list max_length=175 />
                            <button type="submit" class="btn btn-primary btn-small" tabindex="2">
                                    <i class="icon-ok icon-white"></i>&nbsp;
                                    <span class="hidden-phone" >#i18n{portal.features.assign_users.labelButtonValidate}</span>
                                </button>  
                            
                        </form>
                    </fieldset>
                    <#else>
                    <div class="alert alert-error">#i18n{portal.features.assign_users.noUserToAssign}</div>
                    </#if>
                    <fieldset>
                        <legend>#i18n{portal.features.assign_users.labelAssignedUser}</legend>
                        <form class="form-horizontal" method="post" action="jsp/admin/features/AssignUsersRight.jsp">
                            <@paginationAdmin paginator=paginator combo=1 form=0 />
                            <#if search_is_search >
                            <input type="hidden" name="search_is_search" value="true"/>
                            <input type="hidden" name="search_user_level" value="${search_admin_user_filter.userLevel}"/>
                            <input type="hidden" name="search_access_code" value="${search_admin_user_filter.accessCode}"/>
                            <input type="hidden" name="search_last_name" value="${search_admin_user_filter.lastName}"/>
                            <input type="hidden" name="search_first_name" value="${search_admin_user_filter.firstName}"/>
                            <input type="hidden" name="search_email" value="${search_admin_user_filter.email}"/>
                            <input type="hidden" name="search_status" value="${search_admin_user_filter.status}"/>
                            </#if>
                            <#if search_admin_user_field_filter.listUserFields?exists && search_admin_user_field_filter.listUserFields?has_content>
                            <#list search_admin_user_field_filter.listUserFields as user_field>
                            <#if user_field.attribute.attributeType.className == "fr.paris.lutece.portal.business.user.attribute.AttributeComboBox">
                            <input type="hidden" name="attribute_${user_field.attribute.idAttribute}" value="${user_field.attributeField.idField}"/>
                            <#else>
                            <input type="hidden" name="attribute_${user_field.attribute.idAttribute}" value="${user_field.value}" />
                            </#if>
                            </#list>
                            </#if>
                            <input type="hidden" name="id_right" value="${right.id}" />
                        </form>
                    	<table class="table table-striped table-condensed">    
							<tr><th>#i18n{portal.users.manage_users.columnTitleLastName}<@sort jsp_url="jsp/admin/features/AssignUsersRight.jsp" attribute="lastName&id_right=${right.id}${sort_search_attribute}" /></th>
								<th>#i18n{portal.users.manage_users.columnTitleFirstName}<@sort jsp_url="jsp/admin/features/AssignUsersRight.jsp" attribute="firstName&id_right=${right.id}${sort_search_attribute}" /></th> 
								<th>#i18n{portal.users.manage_users.columnTitleAccessCode}<@sort jsp_url="jsp/admin/features/AssignUsersRight.jsp" attribute="accessCode&id_right=${right.id}${sort_search_attribute}" /></th>        
								<th>#i18n{portal.users.manage_users.columnTitleEmail}<@sort jsp_url="jsp/admin/features/AssignUsersRight.jsp" attribute="email&id_right=${right.id}${sort_search_attribute}" /></th>
								<th>#i18n{portal.users.manage_users.columnTitleActions}</th>
							</tr>
							<#list assigned_users_list as assigned_user>
							<#if assigned_user_has_next>
							<#assign anchor = assigned_user_index>
							<#else>
							<#assign anchor = assigned_user_index - 1 >
							</#if>
							<tr id="anchor-${assigned_user_index}">
								<td>${assigned_user.lastName}</td>
								<td>${assigned_user.firstName}</td>
								<td><em>${assigned_user.accessCode}</em></td>            
								<td><a href="mailto:${assigned_user.email}"  title="${assigned_user.email}" >${assigned_user.email}</a>
								</td>
								<td>
									<a class="btn btn-primary btn-small" href="jsp/admin/user/ModifyUser.jsp?id_user=${assigned_user.userId}"  title="#i18n{portal.features.assign_users.actionModify}" >
										<i class="icon-edit icon-white"></i></a>
									<a class="btn btn-danger btn-small" href="jsp/admin/features/DoUnassignUserRight.jsp?id_user=${assigned_user.userId}&amp;id_right=${right.id}&anchor=anchor-${anchor}"  title="#i18n{portal.features.assign_users.actionUnassign}" ><i class="icon-trash icon-white"></i></a>
								</td>
							</tr>
							</#list>		
						</table>
						<@paginationAdmin paginator=paginator />
                    <#else>
						<div class="alert alert-error">#i18n{portal.features.assign_users.noAssignedList}</div>
                    </#if>
					</div>
				</div>
			</fieldset>
    </div>
</div>
